package com.web.server.service.vote;

import com.web.server.dao.vote.VoteDao;
import com.web.server.entity.vote.Vote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by HUJING3 on 2016-12-16.
 */
@Service
public class VoteService {

    @Autowired
    private VoteDao voteDao;

    @Transactional(readOnly = true)
    public List<Map> list(int pageNo, int pageSize) {
        return voteDao.list((pageNo - 1) * pageSize, pageSize);
    }

    @Transactional
    public void insert(Vote vote) {
        voteDao.insert(vote);
    }
}
